/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bd_tenencias;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Earving
 */
@Entity
@Table(name = "tarjeta_circ")
@NamedQueries({
    @NamedQuery(name = "TarjetaCirc.findAll", query = "SELECT t FROM TarjetaCirc t"),
    @NamedQuery(name = "TarjetaCirc.findByIdTarjetacirc", query = "SELECT t FROM TarjetaCirc t WHERE t.idTarjetacirc = :idTarjetacirc"),
    @NamedQuery(name = "TarjetaCirc.findByVigenciaIni", query = "SELECT t FROM TarjetaCirc t WHERE t.vigenciaIni = :vigenciaIni"),
    @NamedQuery(name = "TarjetaCirc.findByVigenciaFin", query = "SELECT t FROM TarjetaCirc t WHERE t.vigenciaFin = :vigenciaFin")})
public class TarjetaCirc implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idTarjeta_circ")
    private Integer idTarjetacirc;
    @Basic(optional = false)
    @Column(name = "vigencia_ini")
    @Temporal(TemporalType.DATE)
    private Date vigenciaIni;
    @Basic(optional = false)
    @Column(name = "vigencia_fin")
    @Temporal(TemporalType.DATE)
    private Date vigenciaFin;
    @JoinColumn(name = "idTenencia", referencedColumnName = "idTenencia")
    @ManyToOne(optional = false)
    private Tenencia tenencia;

    public TarjetaCirc() {
    }

    public TarjetaCirc(Integer idTarjetacirc) {
        this.idTarjetacirc = idTarjetacirc;
    }

    public TarjetaCirc(Integer idTarjetacirc, Date vigenciaIni, Date vigenciaFin) {
        this.idTarjetacirc = idTarjetacirc;
        this.vigenciaIni = vigenciaIni;
        this.vigenciaFin = vigenciaFin;
    }

    public Integer getIdTarjetacirc() {
        return idTarjetacirc;
    }

    public void setIdTarjetacirc(Integer idTarjetacirc) {
        this.idTarjetacirc = idTarjetacirc;
    }

    public Date getVigenciaIni() {
        return vigenciaIni;
    }

    public void setVigenciaIni(Date vigenciaIni) {
        this.vigenciaIni = vigenciaIni;
    }

    public Date getVigenciaFin() {
        return vigenciaFin;
    }

    public void setVigenciaFin(Date vigenciaFin) {
        this.vigenciaFin = vigenciaFin;
    }

    public Tenencia getTenencia() {
        return tenencia;
    }

    public void setTenencia(Tenencia tenencia) {
        this.tenencia = tenencia;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTarjetacirc != null ? idTarjetacirc.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TarjetaCirc)) {
            return false;
        }
        TarjetaCirc other = (TarjetaCirc) object;
        if ((this.idTarjetacirc == null && other.idTarjetacirc != null) || (this.idTarjetacirc != null && !this.idTarjetacirc.equals(other.idTarjetacirc))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bd_tenencias.TarjetaCirc[idTarjetacirc=" + idTarjetacirc + "]";
    }

}
